/**
 * sessionstorage 封装
 */

class SessionstorageAPI {
    set(key: string, value: unknown) {
        return sessionStorage.setItem(key, JSON.stringify(value))
    }

    get(key: string) {
        return JSON.parse(sessionStorage.getItem(key) || '0')
    }

    remove(key: string) {
        return sessionStorage.removeItem(key)
    }
}

const Sessionstorage = new SessionstorageAPI()

export { Sessionstorage }
